/*
 * @Author: 小羊今晚不睡觉 2226764294@qq.com
 * @Date: 2025-10-09 13:35:41
 * @LastEditors: 小羊今晚不睡觉 2226764294@qq.com
 * @LastEditTime: 2025-10-09 13:38:18
 * @FilePath: \yougongxia-backstage\src\views\report\columns.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// src/views/position/columns.ts
import { h } from 'vue';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

/**
 * @description: 工种列表项接口
 */
export interface JobCategoryItem {
  id: number;
  name: string;
  parentId: number | null;
  isActive: boolean;
  created_time: string;
}

// 用于下拉选项
export interface JobCategoryOption {
  label: string;
  value: number;
}

const statusMap = {
  enable: '启用',
  disable: '禁用',
};

export const columns: BasicColumn<JobCategoryItem>[] = [
  {
    title: '工种类别',
    key: 'name',
    align: 'center',
    // width: 80,
    render(record) {
      return record.parentId ? '-' : record.name;
    },
  },
  {
    title: '状态',
    align: 'center',
    key: 'isActive',
    // width: 80,
    render(record) {
      const status = record.isActive ? 'enable' : 'disable';
      return h(
        NTag,
        {
          type: status === 'enable' ? 'success' : 'error',
        },
        { default: () => statusMap[status] }
      );
    },
  }
];
